package com.hao.elasticsearch.contoller;

import com.hao.elasticsearch.service.ContentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

/**
 * @author: 苦逼程序员
 **/
@RestController
public class ContentController {

    @Autowired
    private ContentService service;

    @GetMapping("/pase/{keyword}")
    public Boolean paseContent(@PathVariable("keyword") String keywords)throws Exception{
        Boolean falg = service.paseContent(keywords);
        return falg;
    }

    @GetMapping("/search/{keyword}/{pageNo}/{pageSize}")
    public List<Map<String,Object>> searchPage(
                    @PathVariable("keyword") String keywords,
                    @PathVariable("pageNo") int pageNo,
                    @PathVariable("pageSize") int pageSize)throws Exception{
        List<Map<String, Object>> list = service.searchPageHight(keywords, pageNo, pageSize);
        return list;
    }

}
